home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / haeberli / impression / ssset.c < prev    next >
C/C++ Source or Header  |  1994-08-01  |  2KB  |  78 lines

  1. /*
  2.  * Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. /*
  18.  *    ssset - 
  19.  *        Set the direction, size or brush type on a sample set
  20.  *
  21.  *                Paul Haeberli - 1988
  22.  */
  23. #include "stdio.h"
  24. #include "ss.h"
  25. #include "math.h"
  26.  
  27. #define DIRECTION    2
  28. #define SIZE        4
  29. #define BRUSH        8
  30.  
  31. main(argc,argv)
  32. int argc;
  33. char **argv;
  34. {
  35.     sampleset *iss, *oss;
  36.     int val;
  37.     int i, mode;
  38.  
  39.     if( argc<5 ) {
  40.     fprintf(stderr,"usage: ssset in.ss out.ss val [-d -s -b]\n");
  41.     exit(1);
  42.     } 
  43.     val = atoi(argv[3]);
  44.     for(i=4; i<argc; i++) {
  45.     if(strcmp(argv[i],"-d") == 0)
  46.         mode |= DIRECTION;
  47.     if(strcmp(argv[i],"-s") == 0)
  48.         mode |= SIZE;
  49.     if(strcmp(argv[i],"-b") == 0)
  50.         mode |= BRUSH;
  51.     }
  52.     iss = ssfromfile(argv[1]);
  53.     oss = ssnew();
  54.     dossset(iss,oss,mode,val);
  55.     sstofile(argv[2],oss);
  56. }
  57.  
  58. dossset(iss,oss,mode,val)
  59. sampleset *iss, *oss; 
  60. int mode;
  61. int val;
  62. {
  63.     sample *s, *ns;
  64.  
  65.     s = iss->head;
  66.     while(s) {
  67.     ns = sclone(s);
  68.     if(mode & DIRECTION) 
  69.         ns->SAMPLE_DIR = val;
  70.     if(mode & SIZE) 
  71.         ns->SAMPLE_SIZE = val;
  72.     if(mode & BRUSH) 
  73.         ns->SAMPLE_SHAPE = val;
  74.     addsample(oss,ns);
  75.     s = s->next;
  76.     }
  77. }
  78.